<div class="row m-n">
    <div class="crumbs-bar">
        <div yb-crumbs></div>
    </div>
    <div tabset type="tab">
        <div tab heading="呆滞共享" active="activeFlag[0]" ng-click="changeTab(0)">
            <div class="row wrapper-y-sm">
                <div class="operate-bar col-xs-4 font-0">
                    <button class="btn btn-operate m-r-sm" ng-click="addData()" ng-disabled="!btnPermission.add"
                        title="{{!btnPermission.add?'无权限执行此操作':''}}">新增</button>
                    <button class="btn btn-operate m-r-sm" ng-click="batchDel()" ng-disabled="!btnPermission.batchDel"
                            title="{{!btnPermission.batchDel?'无权限执行此操作':''}}">一键清空</button>
                </div>
                <div class="search-bar wrapper-none col-xs-8">
                    <div class="btn-group m-l-xs pull-right">
                        <button type="button" class="btn btn-default base-color" ng-click="search()" title="刷新">
                            <i class="yb-icon ico-refresh"></i>
                        </button>
                        <div class="btn btn-default base-color" ng-if="btnPermission.import">
                            <div title="导入" ng-click="importData()">
                                <i class="yb-icon ico-import-o"></i>
                            </div>
                        </div>
                        <div class="btn btn-default base-color" ng-if="!!btnPermission.export">
                            <div title="导出">
                                <i class="yb-icon ico-export-o"></i>
                            </div>
                            <ul class="more-tool">
                                <li yb-download download-url="exportParam.sectionUrl"
                                    download-param="exportParam.sectionParam" download-key="ids">
                                    <i class="yb-icon ico-export-o"></i> <span>导出</span>
                                </li>
                                <li yb-download download-url="exportParam.allUrl" download-param="condition" download-duration="3">
                                    <i class="yb-icon ico-export-o"></i> <span>导出全部</span>
                                </li>
                            </ul>
                        </div>
                    </div>
                    <button class="btn-advance pull-right m-l-xs" ng-click="switchToolbar('AdvanceSearch')">高级搜索
                    </button>
                    <div class="input-group pull-right clearfix">
                        <input type="text" class="form-control txt-search" placeholder="零件编号"
                               ng-model="condition.materialNo">
                        <span class="input-group-addon cursor-pointer" ng-click="search(1)">搜索</span>
                    </div>
                </div>
            </div>
            <div yb-advance-search show-toolbar="toolbarConfig.showAdvanceSearch" search-data="search(1)" reset-data="reset()">
                <div class="advance-search m-t-sm">
                    <div class="form-group clearfix">
                        <label class="control-label"><span>零件编号</span>：</label>
                        <textarea class="form-control" placeholder="逗号分隔或者换行分隔" ng-blur="handleBlur($event)"></textarea>
                    </div>
                </div>
            </div>
            <div class="main-area">
                <div yb-table-fixed class="table-fixed-wrap fix-left" ele-count="4" scroll-area="right">
                    <div class="th-fixed">
                        <table class="table-fixed border-none" width="{{tbConf.fixedWidth}}">
                            <thead>
                                <tr>
                                    <th width="40" class="text-center th-check border-l-none">
                                        <div yb-check-box yb-checked="markInfo.allChecked" yb-click="selectAll()"></div>
                                    </th>
                                    <th ng-repeat="itemCol in tbConf.tableCol track by $index" width="{{itemCol.width}}"
                                        ng-show="!!itemCol.isShow && !!itemCol.isFixed">
                                        <div yb-thead-operate ng-model="itemCol" target-width="tbConf.fixedWidth"
                                            fixed-width="tbStyle.scrollLeft"></div>
                                    </th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="th-scroll-x" ng-style="tbStyle.scrollLeft">
                        <table class="table-fixed border-none" width="{{tbConf.scrollWidth}}">
                            <thead>
                                <tr>
                                    <th ng-repeat="itemCol in tbConf.tableCol track by $index" width="{{itemCol.width}}"
                                        ng-show="!!itemCol.isShow && !itemCol.isFixed">
                                        <div yb-thead-operate ng-model="itemCol" target-width="tbConf.scrollWidth">
                                        </div>
                                    </th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="td-scroll-y" ng-show="dataList.length > 0">
                        <table class="table-fixed border-none" width="{{tbConf.fixedWidth}}">
                            <tbody>
                                <tr ng-repeat="item in dataList track by $index"
                                    ng-class="{'row-selected': $index === markInfo.curRow}"
                                    ng-click="selectRow($index)">
                                    <td width="40" class="text-center border-l-none">
                                        <div yb-check-box yb-checked="item.isChecked"
                                             yb-click="selectSingle(item)"></div>
                                    </td>
                                    <td class="spill-dots" ng-repeat="itemCol in tbConf.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !!itemCol.isFixed"
                                        title="{{item[itemCol.dataField]}}">
                                        <span
                                            ng-if="!itemCol.clickFn && itemCol.type !== 'operate'">{{item[itemCol.dataField]}}</span>
                                        <div class="font-0" ng-if="itemCol.type === 'operate'">
                                            <button class="btn btn-operate m-r-xs" ng-click="editData(item.id)"
                                                ng-disabled="!btnPermission.edit || item.orgId!==curOrgId"
                                                title="{{!btnPermission.edit?'无权限执行此操作':(item.orgId!==curOrgId?'不能编辑非本企业的数据':'')}}">编辑</button>
                                            <button class="btn btn-operate m-r-xs" ng-click="delData(item)"
                                                ng-disabled="!btnPermission.delete || item.orgId!==curOrgId"
                                                title="{{!btnPermission.delete?'无权限执行此操作':(item.orgId!==curOrgId?'不能删除非本企业的数据':'')}}">删除</button>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="td-scroll" ng-show="dataList.length > 0" ng-style="tbStyle.scrollLeft">
                        <table class="table-fixed border-none" width="{{tbConf.scrollWidth}}">
                            <tbody>
                                <tr ng-repeat="item in dataList track by $index"
                                    ng-class="{'row-selected': $index === markInfo.curRow}"
                                    ng-click="selectRow($index)">
                                    <td class="spill-dots" ng-repeat="itemCol in tbConf.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !itemCol.isFixed"
                                        title="{{item[itemCol.dataField]}}">
                                        <span ng-if="!itemCol.clickFn">{{item[itemCol.dataField]}}</span>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="no-data w-full text-center p-t" ng-show="dataList.length === 0">暂时没有数据</div>
                </div>
            </div>
            <div class="bottom-area page-bar wrapper-y-sm clearfix">
                <div yb-page-info ng-model="pageInfo" yb-refresh="search()"></div>
            </div>
        </div>
        <div tab heading="新增" active="activeFlag[1]" ng-if="activeFlag[1]">
            <div class="main-area">
                <div yb-table-fixed class="table-fixed-wrap fix-left" ele-count="4" scroll-area="right">
                    <div class="th-fixed">
                        <table class="table-fixed border-none" width="{{tbConfForAdd.fixedWidth}}">
                            <thead>
                                <tr>
                                    <th ng-repeat="itemCol in tbConfForAdd.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !!itemCol.isFixed">
                                        <div yb-thead-operate ng-model="itemCol" target-width="tbConfForAdd.fixedWidth"
                                            fixed-width="tbStyleForAdd.scrollLeft"></div>
                                    </th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="th-scroll-x" ng-style="tbStyleForAdd.scrollLeft">
                        <table class="table-fixed border-none" width="{{tbConfForAdd.scrollWidth}}">
                            <thead>
                                <tr>
                                    <th ng-repeat="itemCol in tbConfForAdd.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !itemCol.isFixed">
                                        <div yb-thead-operate ng-model="itemCol"
                                            target-width="tbConfForAdd.scrollWidth"></div>
                                    </th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="td-scroll-y" ng-show="dataListForAdd.length > 0">
                        <table class="table-fixed border-none" width="{{tbConfForAdd.fixedWidth}}">
                            <tbody>
                                <tr ng-repeat="item in dataListForAdd track by $index"
                                    ng-class="{'row-selected': $index === markInfo.curRow}"
                                    ng-click="selectRow($index)">
                                    <td class="spill-dots" ng-repeat="itemCol in tbConfForAdd.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !!itemCol.isFixed"
                                        title="{{item[itemCol.dataField]}}">
                                        <span
                                            ng-if="!itemCol.clickFn && itemCol.type !== 'operate'">{{item[itemCol.dataField]}}</span>
                                        <div class="font-0" ng-if="itemCol.type === 'operate'">
                                            <button class="btn btn-operate m-r-xs"
                                                ng-click="saveData(item,'add')">保存</button>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="td-scroll" ng-show="dataListForAdd.length > 0" ng-style="tbStyleForAdd.scrollLeft">
                        <table class="table-fixed border-none" width="{{tbConfForAdd.scrollWidth}}">
                            <tbody>
                                <tr ng-repeat="item in dataListForAdd track by $index"
                                    ng-class="{'row-selected': $index === markInfo.curRow}"
                                    ng-click="selectRow($index)">
                                    <td ng-repeat="itemCol in tbConfForAdd.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !itemCol.isFixed"
                                        title="{{item[itemCol.dataField]}}">
                                        <div class="spill-dots" ng-if="!itemCol.needInput">
                                            <span ng-if="!itemCol.clickFn">{{item[itemCol.dataField]}}</span>
                                        </div>
                                        <div class="td-edit pos-r" ng-if="itemCol.needInput">

                                            <div ng-if="itemCol.isQty">
                                                <input type="text" class="form-control"
                                                    ng-model="item[itemCol.dataField]" ng-focus="showQtyTip(item)"
                                                    ng-blur="hideQtyTip(item)" ng-change="checkQty(item)"
                                                    yb-number-input max="99999.999" maxlength="9"
                                                    disable-decimal="false" decimal-places="3"
                                                    ng-class="{'error': item.qtyErr||item.qtyCheckErr}">
                                                <div class="pos-a tool-tips" ng-if="item.showErr&&item.qtyErr">
                                                    <i class="triangle"></i>
                                                    <div class="msg">滞销数量不能为空和0</div>
                                                </div>
                                                <div class="pos-a tool-tips" ng-if="item.showErr&&item.qtyCheckErr">
                                                    <i class="triangle"></i>
                                                    <div class="msg">滞销数量不能大于库存数量</div>
                                                </div>
                                            </div>

                                            <div ng-if="itemCol.isPrice">
                                                <input type="text" class="form-control"
                                                    ng-model="item[itemCol.dataField]" ng-focus="showPriceTip(item)"
                                                    ng-blur="hidePriceTip(item)" ng-change="checkPrice(item)"
                                                    yb-number-input max="99999.999" maxlength="9"
                                                    disable-decimal="false" decimal-places="3"
                                                    ng-class="{'error': item.priceErr}">
                                                <div class="pos-a tool-tips" ng-if="item.showPriceErr&&item.priceErr">
                                                    <i class="triangle"></i>
                                                    <div class="msg">滞销单价不能为空和0</div>
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="no-data w-full text-center p-t" ng-show="dataListForAdd.length === 0">暂时没有数据</div>
                </div>
            </div>
            <div class="bottom-area page-bar wrapper-y-sm clearfix">
                <div yb-page-info ng-model="pageInfoForAdd" yb-refresh="searchForAdd()"></div>
            </div>
        </div>
        <div tab heading="编辑" active="activeFlag[2]" ng-if="activeFlag[2]">
            <div class="main-area">
                <div yb-table-fixed class="table-fixed-wrap fix-left" ele-count="4" scroll-area="right">
                    <div class="th-fixed">
                        <table class="table-fixed border-none" width="{{tbConfForAdd.fixedWidth}}">
                            <thead>
                                <tr>
                                    <th ng-repeat="itemCol in tbConfForAdd.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !!itemCol.isFixed">
                                        <div yb-thead-operate ng-model="itemCol" target-width="tbConfForAdd.fixedWidth"
                                            fixed-width="tbStyleForAdd.scrollLeft"></div>
                                    </th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="th-scroll-x" ng-style="tbStyleForAdd.scrollLeft">
                        <table class="table-fixed border-none" width="{{tbConfForAdd.scrollWidth}}">
                            <thead>
                                <tr>
                                    <th ng-repeat="itemCol in tbConfForAdd.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !itemCol.isFixed">
                                        <div yb-thead-operate ng-model="itemCol"
                                            target-width="tbConfForAdd.scrollWidth"></div>
                                    </th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="td-scroll-y" ng-show="dataList.length > 0">
                        <table class="table-fixed border-none" width="{{tbConfForAdd.fixedWidth}}">
                            <tbody>
                                <tr ng-repeat="item in dataList track by $index"
                                    ng-class="{'row-selected': $index === markInfo.curRow}"
                                    ng-click="selectRow($index)">
                                    <td class="spill-dots" ng-repeat="itemCol in tbConfForAdd.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !!itemCol.isFixed"
                                        title="{{item[itemCol.dataField]}}">
                                        <span
                                            ng-if="!itemCol.clickFn && itemCol.type !== 'operate'">{{item[itemCol.dataField]}}</span>
                                        <div class="font-0" ng-if="itemCol.type === 'operate'">
                                            <button class="btn btn-operate m-r-xs" ng-click="saveData(item,'edit')"
                                                ng-disabled="item.id !== currentId">保存</button>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="td-scroll" ng-show="dataList.length > 0" ng-style="tbStyleForAdd.scrollLeft">
                        <table class="table-fixed border-none" width="{{tbConfForAdd.scrollWidth}}">
                            <tbody>
                                <tr ng-repeat="item in dataList track by $index"
                                    ng-class="{'row-selected': $index === markInfo.curRow}"
                                    ng-click="selectRow($index)">
                                    <td ng-repeat="itemCol in tbConfForAdd.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !itemCol.isFixed"
                                        title="{{item[itemCol.dataField]}}">
                                        <div class="spill-dots" ng-if="!itemCol.needInput || item.id!==currentId">
                                            <span ng-if="!itemCol.clickFn">{{item[itemCol.dataField]}}</span>
                                        </div>
                                        <div class="td-edit pos-r" ng-if="itemCol.needInput && item.id===currentId">

                                            <div ng-if="itemCol.isQty">
                                                <input type="text" class="form-control"
                                                    ng-model="item[itemCol.dataField]" ng-focus="showQtyTip(item)"
                                                    ng-blur="hideQtyTip(item)" ng-change="checkQty(item)"
                                                    yb-number-input max="99999.999" maxlength="9"
                                                    disable-decimal="false" decimal-places="3"
                                                    ng-class="{'error': item.qtyErr||item.qtyCheckErr}">
                                                <div class="pos-a tool-tips" ng-if="item.showErr&&item.qtyErr">
                                                    <i class="triangle"></i>
                                                    <div class="msg">滞销数量不能为空和0</div>
                                                </div>
                                                <div class="pos-a tool-tips" ng-if="item.showErr&&item.qtyCheckErr">
                                                    <i class="triangle"></i>
                                                    <div class="msg">滞销数量不能大于库存数量</div>
                                                </div>
                                            </div>

                                            <div ng-if="itemCol.isPrice">
                                                <input type="text" class="form-control"
                                                    ng-model="item[itemCol.dataField]" ng-focus="showPriceTip(item)"
                                                    ng-blur="hidePriceTip(item)" ng-change="checkPrice(item)"
                                                    yb-number-input max="99999.999" maxlength="9"
                                                    disable-decimal="false" decimal-places="3"
                                                    ng-class="{'error': item.priceErr}">
                                                <div class="pos-a tool-tips" ng-if="item.showPriceErr&&item.priceErr">
                                                    <i class="triangle"></i>
                                                    <div class="msg">滞销单价不能为空和0</div>
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="no-data w-full text-center p-t" ng-show="dataList.length === 0">暂时没有数据</div>
                </div>
            </div>
        </div>
    </div>
</div>
